/**
 * Query objects that specify keys and values in an array where all values are objects.
 * @param   {array}         array   An array where all values are objects, like [{key:1},{key:2}].
 * @param   {string}        key     The key of the object that needs to be queried.
 * @param   {string}        value   The value of the object that needs to be queried.
 * @return  {object|undefined}   Return frist object when query success.
 */
export function queryArray(array, key, value) {
    if (!Array.isArray(array)) {
      return
    }
    return array.filter(_ => _[key] === value)
  }
  
  export function randomNumber(min, max) {
    return Math.floor(Math.random() * (max - min) + min)
  }
  
  export const Constant = {
    ApiPrefix: '/api/v1',
    NotFound: {
      message: 'Not Found',
      documentation_url: '',
    }
  }
  
  export Mock from 'mockjs'
  export qs from 'qs'
  